<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Goods extends Model
{

    protected $table = 'goods';

    protected $primaryKey = 'id';

    public $timestamps = true;

    public function findBrand()
    {
        return $this->belongsTo('App\Model\Brand', 'bid');
    }

    public function findSort()
    {
        return $this->belongsTo('App\Model\Sort', 'sid');
    }

    public function findGoodsPrice()
    {
        return $this->hasMany('App\Model\Gprice', 'gid');
    }

    public function findGoodsDescr()
    {
        return $this->hasOne('App\Model\Gdescr', 'gid');
    }

    public function findGoodsShow()
    {
        return $this->hasMany('App\Model\Gshow', 'gid');
    }

    public function findGoodsDetailsPic()
    {
        return $this->hasMany('App\Model\Gdetails_pic', 'gid');
    }

    public function findCarousels()
    {
        return $this->hasMany('App\Model\Carousels', 'gid');
    }

    public function findSalePromotion()
    {
        return $this->hasMany('App\Model\Sale_promotion', 'gid');
    }

}
